class Person < Searchable

  
  set_table_name "pessoa"

  belongs_to :colegio, :foreign_key => "colegio"
  belongs_to :sexo, :foreign_key  => "sexo"

  #has_many :student
  has_many :teacher

  validates_presence_of :id
  validates_presence_of :cpf
  validates_presence_of :nome
  validates_presence_of :sexo
  validates_presence_of :datanascimento
  validates_presence_of :nomemae
  

  def to_s
    self.nome
  end

  def is_teacher?
    !Teacher.find_by_pessoa(self.id).blank?
  end
  
  def is_pupil?
    !Pupil.find_by_pessoa(self.id).blank?
  end

end
